<template>
	<el-carousel :interval="5000" arrow="always">
		<el-carousel-item v-for="data in results" :key="data">
			<a style="width: 100%;height: 100%" :href="data.url">
				<el-image style="width: 100%;height: 100%" :src="data.image" fit="fill"></el-image>
			</a>
		</el-carousel-item>
	</el-carousel>
</template>
<script>
	import axios from "axios";
	
	export default {
		data() {
			return {
				results: []
			}
		},
		mounted() {
			let results= this.results;
			results.length=0;
			axios.post('/api/video/user/topList')
			        .then(function(response){
						response.data.data.forEach((key) => {
							key.url="#/page/DetailPage/"+key.id;
							results.push(key)
						})
					})
			        .catch(function(error) {
						// 请求失败处理
						  console.log(error);
			        });
		},
		methods: {
		}
	}
</script>
<style>

</style>